<%--
  Created by IntelliJ IDEA.
  User: cos
  Date: 2021/11/18
  Time: 9:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

</head>
<body>
<div id="msg"></div>
<hr>
<button id="btn1">get1 查所有</button>
<button id="btn2">post1 新增</button>
<button id="btn3">get2 byName查询</button>
<button id="btn4">put2 修改</button>
<button id="btn5">del 删除</button>
<a href="http://localhost:8081/shop/getPro">aaa</a>
<script>
    $(function () {
        $("#btn1").click(function () {
            $.ajax({
                url: "/userSys/user",
                type: "get",
                success: function (data) {
                    $("#msg").text(data);
                }
            })
        })
        $("#btn2").click(function () {
            $.ajax({
                url: "/userSys/user",
                type: "post",
                success: function (data) {
                    $("#msg").text(data);
                }
            })
        })
        $("#btn3").click(function () {
            var name = "张三";
            $.ajax({
                url: "/userSys/user/" + name,
                type: "get",
                dataType: "text",
                success: function (data) {
                    $("#msg").text(data);
                }
            })
        })
        $("#btn4").click(function () {
            var user = {uno:1,uname:"李四",usex:"男"};
            $.ajax({
                url: "/userSys/user",
                type: "put",
                dataType: "text",
                data:JSON.stringify(user),
                contentType:"application/json",
                success: function (data) {
                    $("#msg").text(data);
                }
            })
        })
        $("#btn5").click(function () {
            var num=1;
            $.ajax({
                url: "/userSys/user/"+num,
                type: "delete",
                dataType: "text",
                data:JSON.stringify(user),
                contentType:"application/json",
                success: function (data) {
                    $("#msg").text(data);
                }
            })
        })
    })

</script>
</body>
</html>
